import { request} from "../../request/index"

Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperList:[],
    catesList:[],
    floorList:[],
    qqq:false,
    active:0,
    list:["丁丁","还有","当当"]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  //  wx.request({
  //    url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
  //    success: (result)=>{
  //    this.setData({
  //     swiperList:result.data.message
  //    })

  //    },
    
  //  })
  this.getSwiperList();
  this.getCateList();
  this.getloorList();
  },
 
  getSwiperList(){
    request({ url: '/home/swiperdata'}).then(result=>{
      this.setData({
           swiperList:result
         })
      })
   },
   getCateList(){
    request({ url: '/home/catitems'}).then(result=>{
      this.setData({
        catesList:result
         })
      })
   },
  //  获取楼层
   getloorList(){
    request({ url: '/home/floordata'}).then(result=>{
      this.setData({
        floorList:result
         })
      })
   } ,
   aaa(e){
  let {index}=e.currentTarget.dataset
    console.log(e.currentTarget.dataset.index)
     this.setData({
       qqq:this.data.qqq=!this.data.qqq,
       active:index
     })
   },
   bbb(){
   wx.switchTab({
     url: '/pages/cart/index',
   })
   }
})

